<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class Block extends MX_Controller
	{
		private $module = "block";
		
		function __construct(){
			parent::__construct();
			
			$this->load->model($this->module.'_model','block');
		}
		
		// Create Menu
		public function create_menu()
		{
			// DYNAMIC MENU 
			$menu = $this->block->_getParentMenu();
			
			$this->_fillChildMenuList($menu);
			
			$data = array(
				'menu' => $menu
			);
			
			$this->load->view('menu',$data);
		}
		
		/******** DYNAMIC MENU **********/
		// Input : Parent Menu
		// Output: List menu Parent-child menu
		private function _fillChildMenuList(&$parent_list)
		{
			if(!empty($parent_list))
			{
				for($i=0;$i<count($parent_list);$i++)
				{
					$parent_list[$i]['child_list'] = $this->block->_getChildMenu($parent_list[$i]['id']);
				}
			}
		}
	
		public function contact_online()
		{
			$this->load->view('contact_online');
		}
		
		/*
		*	Show bai viet trong box thong tin
		*
		*/
		public function thongtin()
		{
			$thongtin = $this->model->thongtin();
			
			$data = array(
				'thongtin' => $thongtin
			);
			
			$this->load->view('thongtin');
		}
	}
?>